
<style>
  .disease {
    font-size: 30px;
  }

  .category {
    font-size: 10px;
    color: #808080;
  }
</style>
<nav>
  <ol class="cd-multi-steps text-bottom count">
    <li class="visited"><a href="#0">病症</a></li>
    <li class="current"><a href="#">详情</a></li>
    <li><em>诊断关系</em></li>
    <li><em>保存入库</em></li>
  </ol>
</nav>
<h2>病情具体信息</h2>
<p>点击对应添加按钮,完善病症信息</p>
<div style="margin:20px 0;">
</div>

<div id="w" class="easyui-panel" title="添加病症（具体）" data-options="modal:true,iconCls:'icon-list'"
     style="width:500px;height:auto;padding:10px;">

  <div><span class="disease">$!{disease}</span><span class="category"> 分类: $!{category}</span></div>
  <form id="sdff" method="post" action="/addrecipe"  onsubmit="return submitForm()">
    <span>查看单选病情</span>
    <select id="ccc" class="easyui-combobox" name="singlesname" style="width:200px;">
      #foreach($ss in $singles)
      <option>$!{ss}</option>
      #end
    </select>

    #foreach($sname in $snames)
    <div><span style="margin:20px">$!{sname}</span><a class="easyui-linkbutton" iconCls="icon-add"
                                                      onclick="additem('sick$!{foreach.index}')">添加病情项</a>
      <br>
      <ol id="sick$!{foreach.index}">
        <li>
          <input name="sick$!{foreach.index}" type="text" class="easyui-textbox"
                 style="width:50%;height:32px">
        </li>
        <li>
          <input name="sick$!{foreach.index}" type="text" class="easyui-textbox"
                 style="width:50%;height:32px">
        </li>
        <li>
          <input name="sick$!{foreach.index}" type="text" class="easyui-textbox"
                 style="width:50%;height:32px">
        </li>
      </ol>
    </div>
    #end

    <input type="submit" value="下一步" class="easyui-linkbutton c4" style="width:120px">
  </form>
</div>
<script type="text/javascript">
    function additem(k) {
        var sname = "\"" + k + "\"";
        var html = "<li><input name=" + sname + " type='text' class='easyui-textbox' style='width:50%;height:32px'></li>";
        var sid = "#" + k;
        var targetObj = $(html).appendTo(sid);
        $.parser.parse(targetObj.parent);
    }
    function submitForm() {
      //ajax方式提交表单
      $("#sdff").ajaxSubmit(function (message) {//提交成功的回调函数
        console.log(message);
        var tab = $('#tt').tabs('getSelected');  // get selected panel
        $('#tt').tabs('update', {
          tab: tab,
          options: {
            title: '添加诊断关系',
            content: message // the new content URL
          }
        });

      });
      return false;
    }
</script>
